=========================================================================== BBS: The Abacus * HST/DS * Potterville, MI Date: 02-16-93 (02:16) Number: 74 From: DIK COATES Refer#: NONE To: AL SCHOEPP Recvd: NO Subj: Spline program 1/2 Conf: (35) Quick Basi --------------------------------------------------------------------------- >>>> QUOTING Al Schoepp to Dik Coates <<<< AS> I would appreciate it if you could post it so I can see if it will Start of Part 1 of 2 '*************************************************************** SPLCURVE.BAS '***************************************************** TEMPORARY WORKING FILE '***************************************************** COPYRIGHT: R.A. COATES '***************************************************** '*************************************** LISTING DATE:______________________ '*************************************** LAST REVISION: NOV/88, Feb/93 'Permission granted for inclusion in QBS OPTION BASE 1 SCREEN 10 DEF FNDist (x1, y1, x2, y2) 'define functi FNDist = SQR((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)) x1 = 0: y1 = 0: x2 = 0: y2 = 0 END DEF n% = 11 'test ru REDIM x%(n%), y%(n%) x%(1) = 2: y%(1) = 2 'input variabl x%(2) = 20: y%(2) = 12 x%(3) = 45: y%(3) = 48 x%(4) = 100: y%(4) = 40 x%(5) = 70: y%(5) = 30 x%(6) = 165: y%(6) = 150 x%(7) = 300: y%(7) = 200 x%(8) = 450: y%(8) = 40 x%(9) = 300: y%(9) = 40 x%(10) = 450: y%(10) = 265 x%(11) = 550: y%(11) = 325 CALL Splinecurve((n%), x%(), y%()) n% = 9 'test ru REDIM x%(n%), y%(n%) x%(1) = 2: y%(1) = 2 'input variabl x%(2) = 20: y%(2) = 12 x%(3) = 45: y%(3) = 48 x%(4) = 100: y%(4) = 40 x%(5) = 70: y%(5) = 30 x%(6) = 165: y%(6) = 150 x%(7) = 300: y%(7) = 40 x%(8) = 450: y%(8) = 265 x%(9) = 550: y%(9) = 325 CALL Splinecurve((n%), x%(), y%()) n% = 6 'test ru REDIM x%(n%), y%(n%) x%(1) = 10: y%(1) = 10 'input varia x%(2) = 20: y%(2) = 12 x%(3) = 45: y%(3) = 48 x%(4) = 100: y%(4) = 40 x%(5) = 70: y%(5) = 30 x%(6) = 10: y%(6) = 10 CALL Splinecurve((n%), x%(), y%()) n% = 7 'test run REDIM x%(n%), y%(n%) x%(1) = 2: y%(1) = 2 'input variabl x%(2) = 45: y%(2) = 48 x%(3) = 100: y%(3) = 40 x%(4) = 165: y%(4) = 150 x%(5) = 300: y%(5) = 200 x%(6) = 300: y%(6) = 140 x%(7) = 450: y%(7) = 265 CALL Splinecurve((n%), x%(), y%()) LOCATE 20, 10 PRINT "Reclining Lady"; LOCATE 21, 15 PRINT "-by R.A. Coates"; dummy$ = INPUT$(1) '************************** SUBPROGRAM Drawcurve **************************** ' ' Draws a series of lines through points (x(i%),y(i%)), and the screen call ' must be Mode 10 with a monochrome monitor and EGA board or Mode 9 with a ' colour monitor and EGA board. The coordinate is based on the screen ' location with the maximum value of "x" less than or equal to 639 and the ' maximum value of "y" less than or equal to 349. ' ' ARGUMENTS: s%=number of points from the beginning of curve to end ' x()=array for x-coordinates ' y()=array for y-coordinates ' ' RETURNS: nul (plots points on screen) ' ' SUBPROGRAMS CALLED: nul ' SUB Drawcurve (s%, x(), y()) STATIC FOR i% = 1 TO s% - 1 LINE (x(i%), y(i%))-(x(i% + 1), y(i% + 1)) NEXT i% END SUB '************************ SUBPROGRAM Graphpoints **************************** ' ' Draws "x%" through points (x%(i%),y%(i%)). The screen call must be Mode 10 ' for an EGA Adapter and a monochrome monitor and must be Mode 9 for an ' EGA Adapter and a colour monitor. The coordinate is based on the screen ' location with the maximum value of "x%" less than or equal to 639 and the ' maximum value of "y%" less than or equal to 349. ' ' ARGUMENTS: x%()=array for x%-coordinates ' y%()=array for y%-coordinates ' n%=number of points ' ' RETURNS: nul (plots points on screen) ' ' SUBPROGRAMS CALLED: nul ' SUB Graphpoints (x%(), y%(), n%) STATIC FOR i% = 1 TO n% FOR j% = 1 TO 5 LINE (x%(i%) - 3 + j%, y%(i%) - 3 + j%)-(x%(i%) - 3 + j% LINE (x%(i%) - 3 + j%, y%(i%) + 3 - j%)-(x%(i%) - 3 + j% NEXT j% NEXT i% END SUB End of Part 1 ... Insert favourite tagline here. Remember to always plan ahea ___ Blue Wave/QWK v2.10 --- Maximus 2.00 * Origin: Durham Systems (ONLINE!) (1:229/110) SEEN-BY: 1/211 11/2 4 13/13 101/1 108/89 109/25 110/69 114/5 123/19 124/1 SEEN-BY: 153/752 154/40 77 157/2 159/100 125 430 950 203/23 209/209 280/1 SEEN-BY: 390/1 396/1 15 397/2 2230/100 3603/20